cmake_minimum_required(VERSION 3.16)
project(CpeManager LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_DEBUG_POSTFIX d)

# 设置生成路径
if(ANDROID)
    include(android_openssl/CMakeLists.txt)
#    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/CpeManager/android-build/libs/arm64-v8a)
#    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/CpeManager/android-build/libs/arm64-v8a)
#    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/CpeManager/android-build/libs/arm64-v8a)
#    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/CpeManager/android-build/libs/arm64-v8a)

    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/CpeManager)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/CpeManager)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/CpeManager)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/CpeManager)
else()
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin/Debug/)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin/Debug/plugin)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin/Release/)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin/Release/plugin)
endif()

# 寻找Qt
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)

# 添加Qt头文件
# SET(QT_INCLUDES 
#     ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}
#     ${Qt${QT_VERSION_MAJOR}Network_INCLUDE_DIRS}
#     ${Qt${QT_VERSION_MAJOR}Gui_INCLUDE_DIRS}
#     ${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS}
# )
# SET(QT_INCLUDES ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
# include_directories(${QT_INCLUDES})

# 添加子目录
add_subdirectory(CpeVendorHUAWEI)
add_subdirectory(CpeManager)

link_directories(${CMAKE_BINARY_DIR}/lib)
message(${CMAKE_BINARY_DIR}/lib)

# 生成的文件单放
SET_PROPERTY(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated Files")
#开启文件夹
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
#CMake项目放一起
SET_PROPERTY(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake_Target")